<html lang="en" foxified="">
    <head>
        <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JSON压缩转义 | JSON转义 | JSON压缩 |JSON压缩转义工具 - JSON.cn</title>

</head>

<body>

<script type="text/javascript">
    const str = '{\"moduleContent\":[{\"type\":\"block-span-2\",\"style\":\"{\\\\\"height\\\\\":\\\\\"370px\\\\\",\\\\\"marginTop\\\\\":\\\\\"32px\\\\\",\\\\\"gutter\\\\\":32}\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230328000000000002\",\"moduleType\":\"SS\",\"moduleName\":\"首页轮播图\",\"openMode\":\"BLANK\"}]},{\"type\":\"column-2\",\"content\":[{\"moduleId\":\"CM20230318010000000006\",\"moduleType\":\"GI\",\"moduleName\":\"应急科普\",\"openMode\":\"BLANK\",\"displayMode\":\"ceefax\"}]}]},{\"type\":\"block-span-2\",\"style\":\"{\\\\\"marginTop\\\\\":\\\\\"36px\\\\\",\\\\\"gutter\\\\\":32}\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230328010000000001\",\"moduleType\":\"GI\",\"moduleName\":\"工作动态\",\"openMode\":\"BLANK\",\"displayMode\":\"text\"}]},{\"type\":\"column-2\",\"content\":[{\"moduleId\":\"CM20230324000000000006\",\"moduleType\":\"GI\",\"moduleName\":\"应急科普\",\"openMode\":\"BLANK\",\"displayMode\":\"text\"}]}]},{\"style\":\"{\\\\\"marginTop\\\\\":\\\\\"36px\\\\\",\\\\\"gutter\\\\\":32}\",\"type\":\"block-span-1\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230318000000002532\",\"moduleType\":\"HC\",\"moduleName\":\"热门课程\"}]}]},{\"type\":\"block-span-1\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230318000000002533\",\"moduleType\":\"RC\",\"moduleName\":\"推荐分类\"}]}]},{\"type\":\"block-span-1\",\"style\":\"{\\\\\"marginTop\\\\\":\\\\\"4px\\\\\",\\\\\"paddingBottom\\\\\":\\\\\"24px\\\\\"}\",\"content\":[{\"type\":\"coulmn-1\",\"content\":[{\"moduleId\":\"CM20230318000000002535\",\"moduleType\":\"RT\",\"moduleName\":\"名师风采\"}]}]}]}';

    const s = str.replace(/\\\\/gi, "\\").replace(/\"/gi, '\\"');

    const s1 = str.replace(/\\\\/gi, "\\");

    const s2 = str.replace(/\"/gi, '\\"');
    try {
        JSON.parse(s);
    } catch (error) {
        console.error(error);
    }
    try {
        const obj = JSON.parse(s1);
        console.warn(obj);
    } catch (error) {
        console.error(error);
    }
    try {
        JSON.parse(s2);
    } catch (error) {
        console.error(error);
    }
    // debugger;
    // console.warn(str);
    // console.warn(s);
    console.warn(s1);
    // console.warn(s2);
    // JSON.parse(str);
    // '{\"moduleContent\":[{\"type\":\"block-span-2\",\"style\":\"{\\\\\"height\\\\\":\\\\\"370px\\\\\",\\\\\"marginTop\\\\\":\\\\\"32px\\\\\",\\\\\"gutter\\\\\":32}\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230328000000000002\",\"moduleType\":\"SS\",\"moduleName\":\"首页轮播图\",\"openMode\":\"BLANK\"}]},{\"type\":\"column-2\",\"content\":[{\"moduleId\":\"CM20230318010000000006\",\"moduleType\":\"GI\",\"moduleName\":\"应急科普\",\"openMode\":\"BLANK\",\"displayMode\":\"ceefax\"}]}]},{\"type\":\"block-span-2\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230328010000000001\",\"moduleType\":\"GI\",\"moduleName\":\"工作动态\",\"openMode\":\"BLANK\",\"displayMode\":\"text\"}]},{\"type\":\"column-2\",\"content\":[{\"moduleId\":\"CM20230324000000000006\",\"moduleType\":\"GI\",\"moduleName\":\"应急科普\",\"openMode\":\"BLANK\",\"displayMode\":\"text\"}]}]},\"type\":\"block-span-1\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230318000000002532\",\"moduleType\":\"HC\",\"moduleName\":\"热门课程\"}]}]},{\"type\":\"block-span-1\",\"content\":[{\"type\":\"column-1\",\"content\":[{\"moduleId\":\"CM20230318000000002533\",\"moduleType\":\"RC\",\"moduleName\":\"推荐分类\"}]}]},{\"type\":\"block-span-1\",\"content\":[{\"type\":\"coulmn-1\",\"content\":[{\"moduleId\":\"CM20230318000000002535\",\"moduleType\":\"RT\",\"moduleName\":\"名师风采\"}]}]}]}'
</script>

</html>